package com.fengye.jpa.converter.model;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * @Author : sky
 * @Email : <mailto:fengyexjtu@126.com>
 * @Date: 2021/04/12 20:52
 * @Description:
 */
@MappedSuperclass
@EntityListeners(value = AuditingEntityListener.class)
@Data
public abstract class BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @CreatedDate
    @Column(insertable = true, updatable = false)
    private Date create_time;

    @LastModifiedDate
    @Column(insertable = true, updatable = true)
    private Date update_time;
}
